package com.example.test.async.anotherWay;

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.File;

@RestController
public class MyController {
    @Resource
    private MyService myService;
    @Resource
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    @GetMapping("/anotherWay")
    public void test() {
        File dir = new File("/home/wangbo/图片/testimage/50_face");
        File[] files = dir.listFiles();

        for (int i = 0; i < 1; i++) {
            for (int j = 0; j < 50; j++) {
                threadPoolTaskExecutor.submit(new MyTask(myService, files[j]));
            }
        }
    }
}
